% \PStext can be used before switching to a PostScript text font.
% It allows the use of the standard macros for foreign letters and accents.
% \PStext is best used inside a group so that these macro definitions
% automatically revert to the standard definitions at the end of the group.
% If it is undesirable to place \PStext inside a group then \CMtext should
% be called before using a Computer Modern text font.
%
% \PStext assumes you are using the T1-encoded virtual PostScript fonts
% supplied in OzTeX 1.7 (see psnames.tex for the font names).

\catcode`@=11 % allow @ signs in control sequences

\def\@accent@def#1#2#3{\expandafter\def
       \csname @#1@\string#2@#1@\endcsname{#3}}\relax
\def\@accent@use#1#2#3{%
  \expandafter\ifx \csname @#1@\string#3@#1@\endcsname \relax
      {\accent#2 #3}%
    \else  \csname @#1@\string#3@#1@\endcsname\fi}\relax

\def\PStext
{\def\j{j\message{(No dotless j; using j instead!)}}%
\chardef\i25
\chardef\ss255
\chardef\aa229
\chardef\AA197
\chardef\AE198
\chardef\l170
\chardef\L138
\chardef\O216
\chardef\OE215
\chardef\SS223
\chardef\_95
\chardef\ae230
\chardef\oe247
\chardef\o248
\chardef\S159
\chardef\pounds191
\chardef\quotesinglbase13
\chardef\quotedblbase18
\chardef\guillemotleft19
\chardef\guillemotright20
\chardef\guilsinglleft14
\chardef\guilsinglright15
% accents
\def\`{\@accent@use{grave}{0}}%
\let\@accii \`\relax
\@accent@def{grave}{a}{^^e0}%
\@accent@def{grave}{e}{^^e8}%
\@accent@def{grave}{\i}{^^ec}%
\@accent@def{grave}{i}{^^ec}%
\@accent@def{grave}{o}{^^f2}%
\@accent@def{grave}{u}{^^f9}%
\@accent@def{grave}{A}{^^c0}%
\@accent@def{grave}{E}{^^c8}%
\@accent@def{grave}{I}{^^cc}%
\@accent@def{grave}{O}{^^d2}%
\@accent@def{grave}{U}{^^d9}%
\relax
\def\'{\@accent@use{acute}{1}}%
\let\@acci \'\relax
\@accent@def{acute}{n}{^^ab}%
\@accent@def{acute}{l}{^^a8}%
\@accent@def{acute}{r}{^^af}%
\@accent@def{acute}{s}{^^b1}%
\@accent@def{acute}{z}{^^b9}%
\@accent@def{acute}{a}{^^e1}%
\@accent@def{acute}{e}{^^e9}%
\@accent@def{acute}{\i}{^^ed}%
\@accent@def{acute}{i}{^^ed}%
\@accent@def{acute}{o}{^^f3}%
\@accent@def{acute}{u}{^^fa}%
\@accent@def{acute}{y}{^^fd}%
\relax
\@accent@def{acute}{N}{^^8b}%
\@accent@def{acute}{L}{^^88}%
\@accent@def{acute}{R}{^^8f}%
\@accent@def{acute}{S}{^^91}%
\@accent@def{acute}{Z}{^^99}%
\@accent@def{acute}{A}{^^c1}%
\@accent@def{acute}{E}{^^c9}%
\@accent@def{acute}{I}{^^cd}%
\@accent@def{acute}{O}{^^d3}%
\@accent@def{acute}{U}{^^da}%
\@accent@def{acute}{Y}{^^dd}%
\@accent@def{acute}{c}{^^a2}%
\@accent@def{acute}{C}{^^82}%
\relax
\def\v{\@accent@use{check}{7}}%
\@accent@def{check}{c}{^^a3}%
\@accent@def{check}{e}{^^a5}%
\@accent@def{check}{n}{^^ac}%
\@accent@def{check}{r}{^^b0}%
\@accent@def{check}{s}{^^b2}%
\@accent@def{check}{z}{^^ba}%
\relax
\@accent@def{check}{C}{^^83}%
\@accent@def{check}{D}{^^84}%
\@accent@def{check}{E}{^^85}%
\@accent@def{check}{N}{^^8c}%
\@accent@def{check}{R}{^^90}%
\@accent@def{check}{S}{^^92}%
\@accent@def{check}{T}{^^94}%
\@accent@def{check}{Z}{^^9a}%
\relax
\def\u{\@accent@use{breve}{8}}%
\@accent@def{breve}{a}{^^a0}%
\@accent@def{breve}{g}{^^a7}%
\@accent@def{breve}{A}{^^80}%
\@accent@def{breve}{G}{^^87}%
\def\=##1{{\accent9 ##1}}
\let\@acciii \=\relax
\def\^{\@accent@use{circflx}{2}}%
\@accent@def{circflx}{a}{^^e2}%
\@accent@def{circflx}{e}{^^ea}%
\@accent@def{circflx}{\i}{^^ee}%
\@accent@def{circflx}{i}{^^ee}%
\@accent@def{circflx}{o}{^^f4}%
\@accent@def{circflx}{u}{^^fb}%
\@accent@def{circflx}{A}{^^c2}%
\@accent@def{circflx}{E}{^^ca}%
\@accent@def{circflx}{I}{^^ce}%
\@accent@def{circflx}{O}{^^d4}%
\@accent@def{circflx}{U}{^^db}%
\relax
\def\.{\@accent@use{dot}{10}}%
\@accent@def{dot}{z}{^^bb}%
\@accent@def{dot}{Z}{^^9b}%
\@accent@def{dot}{I}{^^9d}%
\@accent@def{dot}{i}{i}%
\relax
\def\H{\@accent@use{Hung}{5}}%
\@accent@def{Hung}{o}{^^ae}%
\@accent@def{Hung}{u}{^^b6}%
\@accent@def{Hung}{O}{^^8e}%
\@accent@def{Hung}{U}{^^96}%
\relax
\def\~{\@accent@use{tilde}{3}}%
\@accent@def{tilde}{a}{^^e3}%
\@accent@def{tilde}{n}{^^f1}%
\@accent@def{tilde}{o}{^^f5}%
\@accent@def{tilde}{A}{^^c3}%
\@accent@def{tilde}{N}{^^d1}%
\@accent@def{tilde}{O}{^^d5}%
\relax
\def\"{\@accent@use{Umlaut}{4}}%
\@accent@def{Umlaut}{a}{^^e4}%
\@accent@def{Umlaut}{e}{^^eb}%
\@accent@def{Umlaut}{\i}{^^ef}%
\@accent@def{Umlaut}{i}{^^ef}%
\@accent@def{Umlaut}{o}{^^f6}%
\@accent@def{Umlaut}{u}{^^fc}%
\@accent@def{Umlaut}{A}{^^c4}%
\@accent@def{Umlaut}{E}{^^cb}%
\@accent@def{Umlaut}{I}{^^cf}%
\@accent@def{Umlaut}{O}{^^d6}%
\@accent@def{Umlaut}{U}{^^dc}%
\relax
\def\b##1{\oalign{##1\crcr\hidewidth
    \vbox to.2ex{\hbox{\char9}\vss}\hidewidth}}%
\def\c##1{\expandafter\ifx
    \csname @cedilla@\string##1@cedilla@\endcsname \relax
    \c@dilla##1\else \csname @cedilla@\string##1@cedilla@\endcsname\fi}%
\@accent@def{cedilla}{s}{^^b3}%
\@accent@def{cedilla}{t}{^^b5}%
\@accent@def{cedilla}{c}{^^e7}%
\@accent@def{cedilla}{S}{^^93}%
\@accent@def{cedilla}{T}{^^95}%
\@accent@def{cedilla}{C}{^^c7}%
\relax
\def\c@dilla##1{\setbox0\hbox{##1}\ifdim\ht0=1ex\accent11 ##1%
  \else{\ooalign{\hidewidth\char11\hidewidth\crcr\unhbox0}}\fi}%
\def\d##1{\oalign{##1\crcr\hidewidth.\hidewidth}}%
}

% \CMtext assumes OT1 encoding (as defined by DEK in The TeXbook):

\def\CMtext
{\chardef\j=17
\chardef\i16
\chardef\ss25
\chardef\ae26
\chardef\oe27
\chardef\o28
\chardef\AE29
\chardef\OE30
\chardef\O31
\def\aa{\accent23a}%
\def\AA{\leavevmode\setbox0\hbox{h}\dimen0\ht0\advance\dimen0-1ex%
\rlap{\raise.67\dimen0\hbox{\char'27}}A}%
\def\l{\char32l}%
\def\L{\leavevmode\setbox0\hbox{L}\hbox to\wd0{\hss\char32L}}%
\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}}%
\def\S{\mathhexbox278}%
\let\pounds\undefined
\let\guillemotleft\undefined
\let\guillemotright\undefined
\let\guilsinglleft\undefined
\let\guilsinglright\undefined
\let\quotedblbase\undefined
\let\quotesinglbase\undefined
\def\"##1{{\accent127 ##1}}%
\def\'##1{{\accent19 ##1}}%
\def\.##1{{\accent95 ##1}}%
\def\=##1{{\accent22 ##1}}%
\def\^##1{{\accent94 ##1}}%
\def\`##1{{\accent18 ##1}}%
\def\~##1{{\accent126 ##1}}%
\def\H##1{{\accent125 ##1}}%
\def\u##1{{\accent21 ##1}}%
\def\v##1{{\accent20 ##1}}%
\def\b##1{\oalign{##1\crcr\hidewidth\sh@ft{29}%
 \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}
\def\c##1{\setbox0\hbox{##1}\ifdim\ht0=1ex\accent24 ##1%
 \else{\ooalign{\unhbox0\crcr\hidewidth\char24\hidewidth}}\fi}
\def\d##1{\oalign{##1\crcr\hidewidth\sh@ft{08}.\hidewidth}}
}

\catcode`@=12 % at signs are no longer letters
